<div class="row">
  <div class='col-lg-2 pull-right'>
      <button class="btn btn-primary col-lg-12 btn-large" data-toggle="modal" data-target="#selectPlan">
        <i class="glyphicon glyphicon-plus"></i> 新建
      </button>
  </div>
</div>
<hr>
<div class="row">
  <div class="col-lg-12">
    <div class="panel panel-default">
      <div class="panel-heading">
          分销返利设置
      </div>


      <!-- /.panel-heading -->
      <div class="panel-body">
        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                  <th>等级</th>
                  <th>返利百分比(%)</th>
                  <th>trafficPlanId</th>
                  <th></th>
              </tr>
            </thead>
            <tbody>
              {{#each aConfigs }}
                <tr>
                  <td>{{ level }}</td>
                  <td>{{ percent }}</td>
                  <td class="row">
                    <div class="col-lg-6 col-xs-12">
                      {{#if trafficPlanId }} {{ selectTag ../../trafficPlanOptions ../../trafficPlanCollection trafficPlanId }} {{/if}}</td>
                    </div>
                  <td>
                    <a href="{{#if trafficPlanId}} /admin/affiliateconfig/trafficplan/{{trafficPlanId}}/edit {{else}} /admin/affiliateconfigs/{{id}}/edit {{/if}}" class="list-group-item col-xs-6">
                      <i class="glyphicon glyphicon-pencil"></i>
                    </a>
                  </td>
                </tr>
              {{/each}}
            </tbody>
          </table>
        </div>
        <!-- /.table-responsive -->
      </div>
      <!-- /.panel-body -->
    </div>
      <!-- /.panel -->
  </div>
</div>


<div class="modal fade" id="selectPlan" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">选择套餐</h4>
      </div>
      <div class="modal-body">
        <div class="row">
          <div id="trafficplan-select2" class="col-lg-12">
              {{ selectTag trafficPlanOptions trafficPlanCollection }}
          </div>
        </div>
        <div id="detail"></div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" id="editOrNew" class="btn btn-primary">选择</button>
      </div>
    </div>
  </div>
</div>

<script id="detail-template" type="text/x-handlebars-template">
  <div class='row'>
    <div class="col-lg-6">
      <div class="form-group">
          <label>套餐</label>
          <input class="form-control" disabled value="\{{ name }}">
      </div>
    </div>
    <div class="col-lg-6">
      <div class="form-group">
          <label>价格</label>
          <input class="form-control" disabled value="\{{ cost }}">
      </div>
    </div>

    <div class="col-lg-6">
      <div class="form-group">
          <label>cost</label>
          <input class="form-control" disabled value="\{{ value }}">
      </div>
    </div>

    <div class="col-lg-6">
      <div class="form-group">
          <label>purchase price</label>
          <input class="form-control" disabled value="\{{ purchasePrice }}">
      </div>
    </div>
  </div>
</script>
